function Lbeam2
clc
% close all
addpath('../');
addpath('../../');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% read mesh
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
projDir = '/home/hbui/kratos_janosch';

projName = 'Lbeam.gid';
fn = [projDir '/' projName '/' 'Lbeam2.msh'];
% du = -1; lambda = 0.62:0.01:0.65;
du = -1; lambda = 0.62:0.001:4;

mg = fem2.gid.GidMeshGenerator(fn);
% mg = fem2.GmshMeshGenerator(fn);

mesh = mg.getMesh(2);
mesh.setNumberOfFields(2);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conditions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
meshUtil = fem2.MeshUtilities(mesh);
c1 = fem2.Constraint([0 0]);
c2 = fem2.Constraint([1 0]);
c2.setValue(1,du);
mesh.setConstraint(c1,meshUtil.seekNodesOnSurface(0,1,0));
meshUtil.seekNode([1 -0.5]).setConstraint(c2);
% plotMesh(mesh,{'normal','conditions','id'});
% return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% element declaration
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
M = fem2.Model(mesh);
nf = mesh.countFaces();
E = 2;
nu = 0.3;
H = -1;
ft = 0.91;
C = C_plane_stress(E,nu);
for i=1:nf
    e = fem2.MatlabStructuralElement(mesh.getFace(i-1));
    M.addElement(e);
    %create struct to contain element state variables
    es = createElementContainer();
    es.H = H;
    es.ft = ft;
    es.constitutiveMatrix = C;
    es.Xi = [0 0]';
    elements(i) = es;
end
%deactivate and activate elements
% for i=1:nf
%     c = computeFaceCenter(mesh.getFace(i-1));
%     if (c(1)>=0 && c(1)<=0.6 && c(2)>=-0.6 && c(2)<=-0.4)
%         elements(i).isActivated = 1;
%     else
%         elements(i).isActivated = 0;
%     end
% end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% solve
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
postProcessInfo.infoList = {'check sigma1','crack opening Linder'};
postProcessInfo.infoParam = {[],[]};

% postProcessInfo.infoList = {'crack opening Linder'};
% postProcessInfo.infoParam = {[]};

[elements,output] = solving_strategy_static_2(elements,M,...
    lambda,50,1e-6,postProcessInfo);

% [elements,output] = solving_strategy_static_4(elements,M,...
%     lambda,dlambda,nt,50,1e-6,postProcessInfo);

plotMeshWithCrack(M,elements,{'normal','conditions'});
% plotDeformedMesh(mesh,0.2);

rmpath('../');
rmpath('../../');

